<?php
/**
 * Created by PhpStorm.
 * User: aaron
 * Date: 2017/7/10
 * Time: 14:08
 */
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
$url = "$protocol$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$api_url = 'http://www.focuscv.com/api/common/getJSSDKToken';
$content = [
    'driver' => 'wechat',
    'key' => 'wx9ab4a0bdab59483c',
    'secret' => '63e8e77cbd12cd83bc67234dd78f5cc0',
    'url' => $url,
];
$curl = curl_init($api_url);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $content);
$response = curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"/>
        <title>怪物大作战</title>
      <link href="css/index.css" rel="stylesheet">
        <script src="//cdn.bootcss.com/jquery/3.1.1/jquery.min.js"></script>
        <script src="https://code.createjs.com/easeljs-0.8.2.min.js"></script>
        <script src="https://code.createjs.com/tweenjs-0.6.2.min.js"></script>
        <script src="https://code.createjs.com/preloadjs-0.6.2.min.js"></script>
        <script src="https://code.createjs.com/soundjs-0.6.2.min.js"></script>
        <script src="js/JiSightComponent.js"></script>
        <script src="js/webSocket/JisightLookAtMe.js"></script>
        <script src="js/webSocket/JisightLookAtMeRef.js"></script>
        <script src="js/tools/tools.js"></script>
        <script src="js/index.js"></script>
    <script src="//res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
    <script src="js/main.js"></script>
    <script src="js/JiSightComponent.js"></script>
    <script>

    //var cardInfo=getCardInfo();
     //console.log(cardInfo);

        var titles = [
                '怪物大作战'
            ];
             window.wx_config =<?=$response?>;
                window.wx_config.title = titles[0];
                window.wx_config.link = '<?=$url?>';
                window.wx_config.imgUrl = 'http://public-sources.oss-cn-shanghai.aliyuncs.com/longines-source/weixin_share.jpg';
              wx.config({
                  debug: false,
                  appId: window.wx_config.app_key,
                  timestamp: window.wx_config.timestamp,
                  nonceStr: window.wx_config.nonce_str,
                  signature: window.wx_config.signature,
                  jsApiList: [
                      'onMenuShareTimeline', 'onMenuShareAppMessage'
                  ]
              });

              wx.ready(function () {
                    wx.onMenuShareTimeline({
                        title: window.wx_config.title,
                        link: window.wx_config.link,
                        desc: window.wx_config.desc,
                        imgUrl: window.wx_config.imgUrl,
                        success: function () {
                            ga('send', 'event', 'pwc_golf/'+location.pathname, 'share', 'onMenuShareTimeline');
                        }
                    });
                    wx.onMenuShareAppMessage({
                        title: window.wx_config.title,
                        link: window.wx_config.link,
                        desc: window.wx_config.desc,
                        imgUrl: window.wx_config.imgUrl,
                        success: function () {
                            ga('send', 'event',  'pwc_golf/'+location.pathname, 'share', 'onMenuShareAppMessage');
                        }
              });
           });
    </script>

</head>
<body>

<!--<input id="test">-->
<div id="share_bg">
    <div id="share_tip">点击右上角按钮分享你的战绩吧！</div>
</div>
<div id="main">
    <div id="loading">
        <div class="title">
        </div>
        <div id="progress">
            <div id="bar">
            </div>
            <div id="loadingNum"></div>
        </div>
        <div id="text"></div>
    </div>
    <input type="text" id="name"/>
    <!--<img src="" id="userImage">-->
    <canvas id="canvas"></canvas>
    <div id="merge" class="btn_merge"><img src="images/btn_merge.png"></div>
    <div id="divide" class="btn_divide"><img src="images/btn_divide.png"></div>

</div>
</body>

</html>